package com.app.controller;


import com.app.entity.Params.ProductSearchParams;
import com.app.entity.Product;
import com.app.service.ProductService;
import com.app.util.PageResult;
import com.app.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author lkg
 * @since 2021-04-14
 */
@RestController
@RequestMapping("/product")
public class ProductController {
    @Autowired
    private ProductService productService;

    /**
     * 查询商品
     */
    @RequestMapping("/findProductByAdmin")
    public PageResult findProductByAdmin(@RequestBody ProductSearchParams productSearchParams) {
        return productService.findProductByAdmin(productSearchParams);
    }
    /**
     * 保存商品
     */
    @RequestMapping("/updateProductByAdmin")
    public Result updateProductByAdmin(@RequestBody Product product){
        return productService.updateProductByAdmin(product);
    }
}

